package top.continew.admin.sport.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Service;

import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
import top.continew.admin.sport.mapper.ProjectEntryTeamMembersMapper;
import top.continew.admin.sport.model.entity.ProjectEntryTeamMembersDO;
import top.continew.admin.sport.model.query.ProjectEntryTeamMembersQuery;
import top.continew.admin.sport.model.req.ProjectEntryTeamMembersReq;
import top.continew.admin.sport.model.resp.ProjectEntryTeamMembersDetailResp;
import top.continew.admin.sport.model.resp.ProjectEntryTeamMembersResp;
import top.continew.admin.sport.service.ProjectEntryTeamMembersService;

/**
 * 项目报名部门（团队）成员业务实现
 *
 * @author xiahaike
 * @since 2024/09/15 02:32
 */
@Service
@RequiredArgsConstructor
public class ProjectEntryTeamMembersServiceImpl extends BaseServiceImpl<ProjectEntryTeamMembersMapper, ProjectEntryTeamMembersDO, ProjectEntryTeamMembersResp, ProjectEntryTeamMembersDetailResp, ProjectEntryTeamMembersQuery, ProjectEntryTeamMembersReq> implements ProjectEntryTeamMembersService {

    @Resource
    private ProjectEntryTeamMembersMapper projectEntryTeamMembersMapper;

    @Override
    public Boolean getOne(ProjectEntryTeamMembersReq projectEntryTeamMembersReq) {
        QueryWrapper<ProjectEntryTeamMembersDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("project_id", projectEntryTeamMembersReq.getProjectId());
        queryWrapper.eq("dept_id", projectEntryTeamMembersReq.getDeptId());
        queryWrapper.eq("user_id", projectEntryTeamMembersReq.getUserId());
        return projectEntryTeamMembersMapper.selectOne(queryWrapper) != null;
    }
}